document.getElementById('send-button').addEventListener('click', sendMessage);

document.getElementById('message-input').addEventListener('keypress', (e) => {
  if (e.key === 'Enter') {
    sendMessage();
  }
});

function sendMessage() {
  const messageInput = document.getElementById('message-input');
  const chatContainer = document.getElementById('chat-container');
  const message = messageInput.value.trim();
  if (message) {
    chatContainer.innerHTML += `<p>You: ${message}</p>`;
    messageInput.value = '';
    // 在这里添加发送消息到服务器的代码
  }
}
